package com.zhuangjie.rider.controller;

import com.zhaungjie.base.conduit.R;
import com.zhuangjie.base.entity.LocationInfo;
import com.zhuangjie.rider.entity.RiderWorkRegion;
import com.zhuangjie.rider.service.RiderWorkRegionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhuangjie
 * @since 2023-12-26
 */
@RestController
@RequestMapping("/rider-work-region")
public class RiderWorkRegionController {
    @Autowired
    private RiderWorkRegionService riderWorkRegionService;
    @GetMapping("/query")
    @ApiOperation("查询骑手工作区域")
    public R queryRiderWorkRegion(){
        return R.require(RiderWorkRegion.class, riderWorkRegionService.getRiderWorkRegion());
    }

    @PostMapping("/update")
    @ApiOperation("更新骑手工作区域")
    public R updateRiderWorkRegion(@Valid @RequestBody LocationInfo locationInfo){
        return R.capture(() -> riderWorkRegionService.updateRiderWorkRegion(locationInfo));
    }

}
